<?php
header("Content-type: text/html; charset=utf-8");

/*
 *---------------------------------------------------------------
 * APPLICATION ENVIRONMENT
 *---------------------------------------------------------------
 *
 * You can load different configurations depending on your
 * current environment. Setting the environment also influences
 * things like logging and error reporting.
 *
 * This can be set to anything, but default usage is:
 *
 *     development
 *     testing
 *     production
 *
 * NOTE: If you change these, also change the error_reporting() code below
 *
 */
	define('ENVIRONMENT', 'development');
	
	//定义错误级
	//error_reporting(E_ALL ^ E_NOTICE);
/*
 * 
 *---------------------------------------------------------------
 * ERROR REPORTING
 *---------------------------------------------------------------
 *
 * Different environments will require different levels of error reporting.
 * By default development will show errors but testing and live will hide them.
 */

if (defined('ENVIRONMENT'))
{
	switch (ENVIRONMENT)
	{
		case 'development':
			error_reporting(E_ALL);
		break;

		case 'testing':
		case 'production':
			error_reporting(0);
		break;

		default:
			exit('The application environment is not set correctly.');
	}
}

error_reporting(E_ALL ^ E_NOTICE);

$system_path = 'system';

$application_folder = 'app';


	if (defined('STDIN'))
	{
		//规定新的当前目录
		//echo getcwd();  获取当前目录
		chdir(dirname(__FILE__));
	}

	//system返回绝对路径
	if (realpath($system_path) !== FALSE)
	{
		//E:\wamp\www\bytxt\system ./
	     $system_path = realpath($system_path).'/';
	
	}

	// ensure there's a trailing slash
	$system_path = rtrim($system_path, '/').'/';

	// Is the system path correct?
	if ( ! is_dir($system_path))
	{
		exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
	}

/*
 * -------------------------------------------------------------------
 *  Now that we know the path, set the main path constants
 * -------------------------------------------------------------------
 */
	// The name of THIS file
	//取数组信息 pathinfo() 返回一个关联数组包含有 path 的信息。
	//E:\wamp\www\bytxt\index.php 
	//index.php
	define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
   define('EXT', '.php');
  // BASEPATH = system_path绝对路径
	define('BASEPATH', str_replace("\\", "/", $system_path));
	
    // Path to the front controller (this file)
	//项目根目录
	//E:\wamp\www\bytxt\ 
	define('FCPATH', str_replace(SELF, '', __FILE__));

   //echo __FILE__;
	// Name of the "system folder"
	//返向截取字符串 E:/wamp/www/bytxt/system/ 
	define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
  

	//application_folder目录
	if (is_dir($application_folder))
	{
		define('APPPATH', $application_folder.'/');
	}
	else
	{
		if ( ! is_dir(BASEPATH.$application_folder.'/'))
		{
			exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
		}

		define('APPPATH', BASEPATH.$application_folder.'/');
	}


//载入system下核心类
//主要完成初始化 CodeIgniter 框架和启动应用程序两项工作。
require_once BASEPATH.'core/CodeIgniter.php';

/* End of file index.php */
/* Location: ./index.php */